/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.etecmatao.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author admin
 */
@Entity
@Table(name = "categoria_download")
@NamedQueries({
    @NamedQuery(name = "CategoriaDownload.findAll", query = "SELECT c FROM CategoriaDownload c"),
    @NamedQuery(name = "CategoriaDownload.findByIdCategoriaDownload", query = "SELECT c FROM CategoriaDownload c WHERE c.idCategoriaDownload = :idCategoriaDownload"),
    @NamedQuery(name = "CategoriaDownload.findByDescricao", query = "SELECT c FROM CategoriaDownload c WHERE c.descricao = :descricao")})
public class CategoriaDownload implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idCategoria_Download")
    private Integer idCategoriaDownload;
    @Basic(optional = false)
    @Column(name = "descricao")
    private String descricao;
    @JoinColumn(name = "email", referencedColumnName = "email")
    @ManyToOne(optional = false)
    private Login login;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "categoriaDownload")
    private List<Download> downloadList;

    public CategoriaDownload() {
    }

    public CategoriaDownload(Integer idCategoriaDownload) {
        this.idCategoriaDownload = idCategoriaDownload;
    }

    public CategoriaDownload(Integer idCategoriaDownload, String descricao) {
        this.idCategoriaDownload = idCategoriaDownload;
        this.descricao = descricao;
    }

    public Integer getIdCategoriaDownload() {
        return idCategoriaDownload;
    }

    public void setIdCategoriaDownload(Integer idCategoriaDownload) {
        this.idCategoriaDownload = idCategoriaDownload;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public Login getLogin() {
        return login;
    }

    public void setLogin(Login login) {
        this.login = login;
    }

    public List<Download> getDownloadList() {
        return downloadList;
    }

    public void setDownloadList(List<Download> downloadList) {
        this.downloadList = downloadList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCategoriaDownload != null ? idCategoriaDownload.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CategoriaDownload)) {
            return false;
        }
        CategoriaDownload other = (CategoriaDownload) object;
        if ((this.idCategoriaDownload == null && other.idCategoriaDownload != null) || (this.idCategoriaDownload != null && !this.idCategoriaDownload.equals(other.idCategoriaDownload))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "admin.model.CategoriaDownload[idCategoriaDownload=" + idCategoriaDownload + "]";
    }

}
